define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_common_goods(result){
			if(HTTP_ISLOGIC){
				result = '{"success":true,"msg":"","result":{"page":{"limit":8,"tPage":1,"cPage":5,"count":2},"goods":[{"goods_id":"goods_id_001","name":"产品111","introduce":"好产品","price":10,"mktprice":11,"preprice":9,"store":100,"image":[{"id":1,"image":"img/upload/pro-img01.jpg"}],"store_id":201,"store_name":"益达","cat_type_name":"扳手"},{"goods_id":"goods_id_002","name":"产品222","introduce":"非常好产品","price":11,"mktprice":12,"preprice":8,"store":150,"image":[{"id":1,"image":"img/upload/pro-img01.jpg"}],"store_id":202,"store_name":"张益达","cat_type_name":"活动扳手"}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else
			return result;
		}
		//返回信息
		return {
			//获取首页数据
			common_goods:function(name,brand_id,cat_type_id,callback){
				Http.post({
					method:'goods.common.getlist',
					name:name,
					pagelimit:8,
					nPage:1,
					show_count:5,
					picSize:'CS',
					brand_id:brand_id,
					cat_type_id:cat_type_id
				},function(result){
					if(callback)
					callback(get_data_common_goods(result).result);
				},function(e){

				},function(){

				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Searchpro_common", factory);
});